"""Project schemas for request/response validation."""

from __future__ import annotations

from datetime import datetime

from pydantic import BaseModel, Field


class ProjectBase(BaseModel):
    """Base project fields."""

    name: str = Field(min_length=1, max_length=255)
    description: str | None = None
    status: str = Field(default="active", pattern="^(active|completed|archived)$")


class ProjectCreate(ProjectBase):
    """Schema for creating a project."""



class ProjectUpdate(BaseModel):
    """Schema for updating a project."""

    name: str | None = Field(None, min_length=1, max_length=255)
    description: str | None = None
    status: str | None = Field(None, pattern="^(active|completed|archived)$")


class ProjectOut(ProjectBase):
    """Schema for project response."""

    id: int
    owner_id: int
    created_at: datetime
    updated_at: datetime

    class Config:
        from_attributes = True
